import math, sequtils
type
  Classify* = enum
    Deficient = -1, Perfect = 0, Abundant = 1, 

proc classify*(num: int): Classify =
  if num <= 0:
    raise newException(ValueError, "not a positive number")

  if num < 6:
    return Deficient
  
  let sqrt = num.float.sqrt.int

  var sum = toSeq(1..sqrt).filterIt(num mod it == 0).foldl(a + b + num div b)
  if sqrt * sqrt == num: sum -= sqrt

  Classify(cmp(sum, num))